from conftest import login_token2
from ApiBase import ApiBase
import pytest,requests,os


class Test_hotNews():
    def test_hotNews_01(self, login_token2):
        """发送评论"""
        userId, token = login_token2
        # 请求地址
        url = 'http://10.59.9.18/hotNews/news/verify/v1/publishComment'
        # 请求头
        headers = {
            'userId': str(userId),
            'token': str(token)
        }
        # 请求体
        data = {
            'newsId': 1,
            'content':'好看好看'
        }
        # 发送post请求
        r = requests.post(url=url, json=data, headers=headers)
        r_json = r.json()
        print(r_json)

    def test_hotNews_02(self, login_token2):
        """回复评论"""
        userId, token = login_token2
        # 请求地址
        url = 'http://10.59.9.18/hotNews/news/verify/v1/publishReply'
        # 请求头
        headers = {
            'userId': str(userId),
            'token': str(token)
        }
        # 请求体
        data = {
            'commentId': 1,
            'content':'说得好'
        }
        # 发送post请求
        r = requests.post(url=url, json=data, headers=headers)
        r_json = r.json()
        print(r_json)